<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
    
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script src="./models//Http.js"></script>
    <title>Document</title>
</head>
<body>
    <div id="app">

        <div v-for="(item,index) of movies">
            <p>{{index | handleTitle}}</p>
        </div>
    </div>
    <script>
        new Vue({
            el:"#app",
            data:{
                movies:{}
            },
            async mounted() {
                // MovieHttp.getMovie("top250").then(res=>{
                //     console.log(res.data);
                // })
                var https =  ["top250","comingSoon","inTheaters"];
                let movies = {}
                for(let url of https){
                    let res = await MovieHttp.getMovie(url)
                    movies[url] = res.data.res
                }
                this.movies = movies
            },
            filters:{
                handleTitle(val){
                    if(val=="inTheaters"){
                        return "正在热映"
                    }else if(val=="comingSoon"){
                        return "即将上映"
                    }
                    return val;
                }
            }
        })
    </script>
</body>
</html>